home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / cp1.zip / GETKEY.C < prev    next >
C/C++ Source or Header  |  1993-06-01  |  3KB  |  68 lines

  1. ===========================================================================
  2.  BBS: The Abacus * HST/DS * Potterville, MI
  3. Date: 05-30-93 (07:46)             Number: 60
  4. From: LEO VILDOSOLA                Refer#: 160
  5.   To: JOHN KASIEWICZ                Recvd: NO  
  6. Subj: EXTENDED KEYS - AFTER THE      Conf: (36) C Language
  7. ---------------------------------------------------------------------------
  8. JK>   In a program of mine, I would like to use extended characters (More
  9. JK>specifically, the Fkeys) .. I am able to decipher the 0, by way of CASE 0:,
  10. JK>I'm not able to read which extended character it is. Could someone
  11. JK>please explain to me the next step to getting, say, a 59 for F1?
  12.  
  13. /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  14. /*   Source File: GETKEY.C                 Date:  May 29, 1993   */
  15. /*   Released As Public Domain                                   */
  16. /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  17.  
  18. /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  19. /*   Header File(s)                                              */
  20. /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  21. #include <dos.h>
  22.  
  23. /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  24. /*   This Function Gets The Next Character From The Keyboard     */
  25. /*                                                               */
  26. /*   Returns The Key Pressed.                                    */
  27. /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  28. unsigned short int GetKey( void )
  29. {
  30.   union REGS reg;
  31.   unsigned short int ch;
  32.  
  33.   while( 1 ) {
  34.     reg.h.ah = 0x01;
  35.     int86( 0x16, ®, ® );
  36.     if( reg.x.flags & 0x40 ) {
  37.       int86( 0x28, ®, ® );       /* to allow TSRs to popup */
  38.       continue;
  39.     }
  40.     reg.h.ah = 0x00;
  41.     int86( 0x16, ®, ® );
  42.     if( reg.h.al == 0x00 )
  43.       ch = reg.h.ah | 0x100;
  44.     else
  45.       ch = reg.h.al;
  46.     break;
  47.   }
  48.   return( ch );
  49. }
  50.  
  51. /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  52. /*   End Of File: GETKEY.C                                       */
  53. /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  54.  
  55. This way all you have to do is define your function keys, for example,
  56. by adding 256 to its value (ie, if F1 is 59, you define it as 315).
  57. Vuola, no more conflicts.
  58.  
  59. G'd day!
  60. Leo Vildosola
  61.  
  62.  * OLX 2.1 TD * ... Real men use BASIC.  C is for Unix!!!
  63. --- FidoPCB v1.4 beta
  64.  * Origin: XON/XOFF Information Service - Montreal - @xonxoff.com (1:167/15
  65. SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
  66. SEEN-BY: 153/752 154/40 77 157/110 159/100 125 575 950 203/23 209/209
  67. SEEN-BY: 261/1023 280/1 390/1 396/1 5 15 2270/1 2440/5 3603/20
  68.